/**
 * Copyright &copy; 2016 CNJSON All rights reserved.
 */
package com.hongsuan.pplive.modules.cms.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cnjson.db.persistence.Page;
import com.cnjson.db.service.CrudService;
import com.hongsuan.pplive.modules.cms.dao.UserCourseScoreDao;
import com.hongsuan.pplive.modules.cms.entity.UserCourse;

/**
 * 学员成绩管理Service
 * @author Susan
 * @version 2015-11-30
 */
@Service
@Transactional(readOnly = true)
public class UserCourseScoreService extends CrudService<UserCourseScoreDao, UserCourse> {

	public List<UserCourse> findList(UserCourse userCourse) {
		return dao.findList(userCourse);
	}

	public Page<UserCourse> findPage(Page<UserCourse> page, UserCourse userCourse) {
        userCourse.setPage(page);
        page.setList(dao.findList(userCourse));
        return page;
	}

	@Transactional(readOnly = false)
	public void save(UserCourse userCourse) {
        UserCourse existCourse = dao.get(userCourse);

        if (existCourse == null){
            dao.insert(userCourse);
        }else{
            dao.update(userCourse);
        }
	}

	@Transactional(readOnly = false)
	public void delete(UserCourse userCourse) {
        dao.delete(userCourse);
	}

    public UserCourse get(UserCourse userCourse) {
        return dao.get(userCourse);
    }
}